package com.znh.kuiklyuniversity.model

import android.util.Log
import android.widget.Toast
import com.tencent.kuikly.core.render.android.export.KuiklyRenderBaseModule
import com.tencent.kuikly.core.render.android.export.KuiklyRenderCallback

class NativalModel : KuiklyRenderBaseModule() {
    // 传输基本类型、数组、字符串
    override fun call(method: String, params: Any?, callback: KuiklyRenderCallback?): Any? {
        return when (method) {
            "log" -> log((params ?: "").toString())
            else -> super.call(method, params, callback)
        }
    }

    private fun log(content: String) {
        Log.d("test", content)
        Toast.makeText(this.context,content,Toast.LENGTH_SHORT).show()
    }

//    // 传输Json（会被序列化为Json字符串）
//    override fun call(method: String, params: String?, callback: KuiklyRenderCallback?): Any? {
//
//    }
}